﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.IO;

namespace SDLITS.Web.CommonClass
{
    /// <summary>
    /// UploadHandler 的摘要说明
    /// </summary>
    public class UploadHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string server = ConfigurationManager.AppSettings["AppServer"];
            HttpPostedFile oFile = context.Request.Files["Filedata"];
            if (oFile != null)
            {
                string sDirectory = string.Format(@"\\{0}\CamShotTemp\", server);
                if (!Directory.Exists(sDirectory))
                    Directory.CreateDirectory(sDirectory);

                oFile.SaveAs(Path.Combine(sDirectory, context.Request.QueryString["id"] + ".jpg"));
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}